package com.dengke.mybatis.test;

import java.io.IOException;
import java.io.InputStream;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import com.dengke.mybatis.entity.City;
import com.dengke.mybatis.mapper.ICity;

public class Mian {

	public static void main(String[] args)throws IOException {
		String resource = "SqlMapConfig.xml";

		InputStream inputStream = Resources.getResourceAsStream(resource);
		SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);

		SqlSession sqlSession = sqlSessionFactory.openSession();
		ICity cityService= sqlSession.getMapper(ICity.class);
		City city= cityService.getCity(1);
//		City city = sqlSession.selectOne("com.dengke.mybatis.mapper.getCity", 1);
		System.out.println(city.toString());
	}

}
